'use strict';
/**
 * Created by FreezeSoul on 2015/10/28.
 */
define([
    'angular',
    'underscore',
    'angularBootstrap',
    'angularUnderscore',
    'angularUiNotify',
    'angularColorPicker',
    'angularSortable'
], function (angular) {
    angular.module('ad.editor',
        [
            'underscore',
            'ui.bootstrap',
            'ui-notification',
            'colorpicker.module',
            'as.sortable'
        ]
    ).config(['$controllerProvider', '$provide', '$compileProvider', '$filterProvider',
        function ($controllerProvider, $provide, $compileProvider, $filterProvider) {
            //https://www.bennadel.com/blog/2553-loading-angularjs-components-after-your-application-has-been-bootstrapped.htm
            // Let's keep the older references.
            var app = angular.module('ad.editor');
            app._controller = app.controller;
            app._service = app.service;
            app._factory = app.factory;
            app._value = app.value;
            app._directive = app.directive;
            app._filter = app.filter;
            // Provider-based controller.
            app.controller = function (name, constructor) {
                $controllerProvider.register(name, constructor);
                return ( this );
            };
            // Provider-based service.
            app.service = function (name, constructor) {
                $provide.service(name, constructor);
                return ( this );
            };
            // Provider-based factory.
            app.factory = function (name, factory) {
                $provide.factory(name, factory);
                return ( this );
            };
            // Provider-based value.
            app.value = function (name, value) {
                $provide.value(name, value);
                return ( this );
            };
            // Provider-based directive.
            app.directive = function (name, factory) {
                $compileProvider.directive(name, factory);
                return ( this );
            };
            // Provider-based filter.
            app.filter = function (name, constructor) {
                $filterProvider.register(name, constructor);
                return ( this );
            };
        }]
    );
});